package solutions.ferpa.ztest.rest.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Alerts implements Serializable{

    private List<String> errors;
    private List<String> warnings;

    public Alerts() {
        errors = new ArrayList<String>();
        warnings = new ArrayList<String>();
    }

    public void addError(String error) {
        errors.add(error);
    }

    public void clearErrors() {
        errors.clear();
    }

    public String[] getErrors() {
        return errors.toArray(new String[1]);
    }

    public boolean hasErrors() {
        return !errors.isEmpty();
    }

    public void addWarning(String warning) {
        warnings.add(warning);
    }

    public void clearWarnings() {
        warnings.clear();
    }

    public String[] getWarnings() {
        return warnings.toArray(new String[1]);
    }

    public boolean hasWarnings() {
        return !warnings.isEmpty();
    }

    public boolean isEmpty() {
        return (errors.isEmpty() && warnings.isEmpty());
    }
}
